<?php
 if ($this->subTmp == '0') {  ?>
<li>
	<a href="#" onclick=""><?php echo $data->sub_category->name;?></a>
	<ul>
		<li><a class="t-btn" href="<?php if($data->category->name==$_SERVER['REQUEST_URI']){echo "Javascript:";}else{echo $data->category->name;}?>" id="<?php echo $data->divId;?>"><?php echo $data->title;?></a></li>
<?php } else { ?>
	<?php if ($data->sub_category->name == $this->subTmp) { ?>
		<li><a class="t-btn" href="<?php if($data->category->name==$_SERVER['REQUEST_URI']){echo "Javascript:";}else{echo $data->category->name;}?>" id="<?php echo $data->divId;?>"><?php echo $data->title;?></a></li>
	<?php } else { ?>
	</ul>
</li>
<li>
	<a href="#" onclick=""><?php echo $data->sub_category->name;?></a>
	<ul>
		<li><a class="t-btn" href="<?php if($data->category->name==$_SERVER['REQUEST_URI']){echo "Javascript:";}else{echo $data->category->name;}?>" id="<?php echo $data->divId;?>"><?php echo $data->title;?></a></li>
	<?php } ?>
<?php } ?>	
<?php $this->subTmp = $data->sub_category->name; ?>